﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Patent.LJ;
using Patent.CN;
using System.Data;
using DevExpress.XtraCharts;

public partial class China_Chart_OrientAreaAnalysisChart : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string local = Request["selected"];
        Topic topic = new Topic(Convert.ToInt32(Session["topicID"].ToString()));
        //Patent.Topic topic = new Topic(1);
        string localTable = topic.OriginalTable;//原产区表名


        if (string.IsNullOrEmpty(local))
        {
            Response.End();
            Response.Flush();
        }
        string[] area = local.Split(',');
        ChinaAnalysis ana = new ChinaAnalysis();
        DataTable dt = ana.GetLocalArea(area, localTable);
        for (int i = 0; i < dt.Columns.Count; i++)
        {
            switch (dt.Columns[i].ColumnName)
            {
                case "dm": dt.Columns[i].ColumnName = "国省代码"; break;
                case "sy": dt.Columns[i].ColumnName = "实用新型"; break;
                case "fm": dt.Columns[i].ColumnName = "发明专利"; break;
                case "wg": dt.Columns[i].ColumnName = "外观设计"; break;
                case "zj": dt.Columns[i].ColumnName = "总计"; break;
                default: break;
            }
        }

        WebChartCN.Series.Clear();
        
        Series syxxSeries = new Series("实用新型", ViewType.ManhattanBar);
        Series fmzlSeries = new Series("发明专利", ViewType.ManhattanBar);
        Series wgsjSeries = new Series("外观设计", ViewType.ManhattanBar);

        WebChartCN.Series.Add(syxxSeries);
        WebChartCN.Series.Add(fmzlSeries);
        WebChartCN.Series.Add(wgsjSeries);


        syxxSeries.ArgumentScaleType = ScaleType.Qualitative;
        syxxSeries.ValueScaleType = ScaleType.Numerical;
        fmzlSeries.ArgumentScaleType = ScaleType.Qualitative;
        fmzlSeries.ValueScaleType = ScaleType.Numerical;
        wgsjSeries.ArgumentScaleType = ScaleType.Qualitative;
        wgsjSeries.ValueScaleType = ScaleType.Numerical;


        syxxSeries.DataSource = dt;
        syxxSeries.ArgumentDataMember = "国省代码";
        syxxSeries.ValueDataMembers.AddRange(new string[] { "实用新型" });
 
        syxxSeries.PointOptions.PointView = PointView.ArgumentAndValues;

        fmzlSeries.DataSource = dt;
        fmzlSeries.ArgumentDataMember = "国省代码";
        fmzlSeries.ValueDataMembers.AddRange(new string[] { "发明专利" });

        fmzlSeries.PointOptions.PointView = PointView.ArgumentAndValues;

        wgsjSeries.DataSource = dt;
        wgsjSeries.ArgumentDataMember = "国省代码";
        wgsjSeries.ValueDataMembers.AddRange(new string[] { "外观设计" });

        wgsjSeries.PointOptions.PointView = PointView.ArgumentAndValues;
        // Prevent IE Cache
        Response.Expires = 0;

    }
}
